﻿using System.Threading.Tasks;
using System.Collections.Generic;
using ManageSystem.IService;
using ManageSystem.IRepository;
using ManageSystem.Repository;

namespace ManageSystem.Service
{
    public class BaseService<T> : IBaseService<T> where T : class, new()
    {
        // Repository manager
        public IBaseRepository<T> baseDal = new BaseRepository<T>();
        public async Task<bool> Add(T model)
        {
            return await baseDal.Add(model);
        }
        public async Task<bool> DeleteByPrimaryKey(object key)
        {
            return await baseDal.DeleteByPrimaryKey(key);
        }
        public async Task<T> QueryByPrimaryKey(object key)
        {
            return await baseDal.QueryByPrimaryKey(key);
        }

        public async Task<List<T>> QueryAll()
        {
            return await baseDal.QueryAll();
        }

        public async Task<bool> Update(T model)
        {
            return await baseDal.Update(model);
        }

    }
}
